import {
  ProColumns,
  ProTable,
} from '@ant-design/pro-components';
import '@umijs/max';
import { Modal } from 'antd';
import React from 'react';

export type Props = {
  columns: ProColumns<API.Question>[];
  onCancel: () => void;
  onSubmit: (values: API.Question) => Promise<void>;
  createModalOpen: boolean;
};
const CreateModal: React.FC<Props> = (props) => {
  const {columns, createModalOpen, onCancel, onSubmit} = props;
  return (
    <Modal open={createModalOpen} onCancel={() => onCancel?.()}>
      <ProTable type="form" columns={columns} onSubmit={async (value) => {
        onSubmit?.(value);
      }
      }/>
    </Modal>
  );
};
export default CreateModal;
